Search
woogc/show_network_orders - WP Global Cart
15263
documentation-template-default,single,single-documentation,postid-15263,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-6.3.0,vc_responsive
 

woogc/show_network_orders

WP Global Cart / woogc/show_network_orders
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

woogc/show_network_orders

Name: woogc/show_network_orders
Type: Filter
Arguments: $status

The filter can be used to show the Network Orders interface to other shops in the MultiSite environment.

The following code example, show the interface for shops ID’s 2 and 3:


    add_filter('woogc/show_network_orders', 'WooGC_show_network_orders');
    function WooGC_show_network_orders( $status )
        {
            global $blog_id;
            
            if ( in_array ( $blog_id , array ( 2, 3 ) ) )
                return TRUE;
            
            return $status;   
        }

The following code example, show the interface for user ID 40:


    add_filter('woogc/show_network_orders', 'WooGC_show_network_orders_for_users');
    function WooGC_show_network_orders_for_users( $status )
        {
            global $userdata;
            
            if ( in_array ( $userdata->ID , array ( 40 ) ) )
                return TRUE;
            
            return $status;   
        }

Multiple conditions can be checked before allowing the interface, this code check for user 40 and allow only on site ID 2


    add_filter('woogc/show_network_orders', 'WooGC_show_network_orders_for_users');
    function WooGC_show_network_orders_for_users( $status )
        {
            global $userdata, $blog_id;
            
            //Presume all conditions are correct
            $status =   TRUE;
            
            if ( in_array ( $userdata->ID , array ( 40 ) ) )
                $status =   FALSE;
                
            if ( in_array ( $blog_id , array ( 2 ) ) )
                $status =   FALSE;
            
            return $status;   
        }

The code should be placed inside a php file on wp-content/mu-plugins folder.

0
Would love your thoughts, please comment.x
()
x